<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta name="screen-orientation" content="portrait">
    <meta name="x5-orientation" content="portrait">
    <title>商户登录</title>
    <link rel="stylesheet" href="../../styles/h5/reset.min.css"/>
    <link rel="stylesheet" href="../../styles/h5/errortankuang.css"/>
    <!--以上为公共css样式-->
    <link rel="stylesheet" href="../../styles/h5/index.css"/>

    <script charset="utf-8" type="text/javascript" src="../../scripts/h5/jquery-1.9.1.min.js"></script>
    <script charset="utf-8" type="text/javascript" src="../../scripts/h5/jquery.modal.js"></script>
    <!--以上为公共js文件-->
</head>
<body>
<div class="zz-list">
    <ul>
        <li>
            <span class="zz-left">收款人身份证</span
            ><input class="zz-code-num zz-id-num" type="text" placeholder="请输入身份证号" maxlength="18"/>
        </li>
        <li>
            <span class="zz-left">收款人手机号</span
            ><input class="zz-code-num zz-phone-code" type="tel" placeholder="请输入收款人手机号" maxlength="11"/>
        </li>
        <li class="zz-position">
            <span class="zz-left">验证码</span
            ><input class="zz-code-num zz-verification-code" type="tel" placeholder="请输入验证码" maxlength="6"/>
            <input class="zz-code" type="button" value="获取验证码"/>
        </li>
    </ul>

</div>
<div class="zz-read zz-paddingLeft">
    <span class="zz-check"></span>
    <span>同意</span>
    <a href="http://m.soopay.net/c/static/jhizljjl">《享云商户注册及服务协议》</a>
</div>
<input class="footer" type="button" value="登录">
</body>
<script charset="utf-8" type="text/javascript" src="../../scripts/h5/utils.js"></script>
<script charset="utf-8" type="text/javascript" src="../../scripts/h5/index.js"></script>

<script charset="utf-8" type="text/javascript">
    var smsVerifyTrace = "";
    //点击获取验证码
    $code.click(function () {
        var that = $(this);
        //判断手机号
        if (!utils.effectivePhone($phone_code.val(), that)) {
            return false
        }
        var bankMobileId = utils.removeSpace($phone_code.val());
        $.ajax({
            url: utils.ajaxUrl() + "h5/registerController/send",
            async: false,
            data: {
                bankMobileId: bankMobileId
            },
            type: 'get',
            success: function (res) {
                //var res = JSON.parse(res);
                if (res && res.retCode == '0000') {
                    utils.time(that);
                    smsVerifyTrace = res.smsVerifyTrace
                } else {
                    utils.newModalPrompt(res.retMsg, that);
                }
            },
            error: function () {
                utils.newModalPrompt("数据异常", that);
            }
        });
    });

    function check() {
        if ($check.hasClass("zz-not-check")) {
            $check.removeClass("zz-not-check");
        } else {
            $check.addClass("zz-not-check");
        }
    }

    $check.click(function () {
        check();
    });

    $footer.click(function () {
        var payeeInidcard = $id_num.val();
        var bankMobileId = utils.removeSpace($phone_code.val());
        var verifyCode = $verification_code.val();
        //正则判断身份证
        if (!utils.effectiveId(payeeInidcard, $footer)) {
            return false
        }

        //判断手机号
        if (!utils.effectivePhone(bankMobileId, $footer)) {
            return false
        }

        //判断验证码
        if (!utils.effectiveNum(verifyCode, $footer)) {
            return false
        }

        // 判断勾是否被选中
        if ($check.hasClass("zz-not-check")) {
            utils.newModalPrompt('请您阅读并同意服务协议。', $footer);
            return false;
        }

        utils.newModalAnimationShow("加载中");

        $.ajax({
            url: utils.ajaxUrl() + "h5/registerController/register",
            data: {
                bankMobileId: bankMobileId,
                smsVerifyTrace: smsVerifyTrace,
                verifyCode: verifyCode,
                payeeInidcard: payeeInidcard
            },
            async: false,
            type: 'get',
            success: function (res) {
                console.log(res);
                if (res && res.retCode == "0000") {
                    utils.newModalAnimationHide();
                    WeixinJSBridge.call('closeWindow');
                } else {
                    utils.newModalAnimationHide(0);
                    utils.newModalPrompt(res.retMsg, $footer);
                }
            },
            error:function (){
                utils.newModalPrompt("数据异常", $footer);
            }
        });
    })
</script>
</html>